/**
 * 
 */
package durak.common.control;

import java.io.Serializable;

import durak.common.model.Card;
import durak.common.model.Cards;
import durak.common.model.GameTableState;

/**
 * @author miri
 * 
 */
public class GameCommand implements Serializable {

	/**
     * 
     */
	static public enum CommandType {
		S2C_NOTIFY_STATE, S2C_ATTACK, S2C_DEFEND, S2C_TAKE_CARDS, S2C_GAME_FINISHED, S2C_LOST, S2C_ROUND_FINISHED, C2S_JOIN, C2S_GET_GAME_STATE, C2S_ATTACKED, C2S_DEFENDED, C2S_WITHDRAWN, C2S_PASS_ATTACK, C2S_QUIT, S2C_TABLE_FULL
	}

	private CommandType command;
	private int version;
	private GameTableState gameState;
	private String playerName;
	private Cards cards;
	private String gameName;

	/**
	 * @return the command
	 */
	public CommandType getCommand() {
		return command;
	}

	/**
	 * @param command the command to set
	 */
	public void setCommand(CommandType command) {
		this.command = command;
	}

	/**
	 * @return the gameName
	 */
	public String getGameName() {
		return gameName;
	}

	/**
	 * @param gameName the gameName to set
	 */
	public void setGameName(String gameName) {
		this.gameName = gameName;
	}

	public GameTableState getGameState() {
		return gameState;
	}

	public void setGameState(GameTableState gameState) {
		this.gameState = gameState;
	}

	/**
	 * 
	 */
	public GameCommand(CommandType command, Cards cards) {
		super();
		this.command = command;
		this.cards = cards;
		this.gameState = null;
		this.version = 0;
	}

	public GameCommand() {
	}

	public GameCommand(CommandType command, Card card) {
		this.command = command;
		cards = new Cards();
		this.cards.addCard(card);

	}

	public GameCommand(CommandType command) {
		this.command = command;
	}

	/**
	 * @return the command
	 */
	public CommandType getCommandType() {
		return command;
	}

	/**
	 * @param command
	 *            the command to set
	 */
	public void setCommandType(CommandType command) {
		this.command = command;
	}

	/**
	 * @return the cards
	 */
	public Cards getCards() {
		return cards;
	}

	/**
	 * @param cards
	 *            the cards to set
	 */
	public void setCards(Cards cards) {
		this.cards = cards;
	}

	public String getPlayerName() {
		return playerName;
	}

	/**
	 * @param playerName
	 *            the playerName to set
	 */
	public void setPlayerName(String playerName) {
		this.playerName = playerName;
	}

	public void printCommand() {
		System.out.println(this.playerName);
		System.out.println(this.getCommandType());

	}

	/**
	 * @return the version
	 */
	public int getVersion() {
		return version;
	}

	/**
	 * @param version the version to set
	 */
	public void setVersion(int version) {
		this.version = version;
	}

}
